import Vue from 'vue';
import VueRouter from 'vue-router';
import layout from '@/layout/indexCopy.vue';
import Login from '@/components/Login.vue';
import manageArea from '@/views/manageArea/manageArea.vue';
import Dashboard from "@/views/dashboard/dashboard.vue";
Vue.use(VueRouter);

const routes = [
  // {
  //   path: '/',
  //   redirect: '/dashboard',
  //   component:layout,
  //   children:[{
  //     path: 'dashboard',
  //     component: () => import('@/views/dashboard/dashboard.vue'),
  //   }]
  // },
  {
    path: '/dashboard',
    name: 'dashboard',
    component:layout,
    children:[{
      path: 'dashboard',
      component: Dashboard,
      meta:{
        keepAlive:true
      }
    },
    ],
    meta:{
      keepAlive:true
    }
  },
  {
    path: '/manageArea',
    name: 'manageArea',
    component:layout,
    children:[{
      path: 'manageArea',
      component: manageArea,
      meta:{
        keepAlive:true
      }
    },
    ],
    meta:{
      keepAlive:true
    }
  },
  {
    path: '/',
    redirect: '/login',
    name:'login',
    component: Login,
    children:[ //配置子路由
      {
        path: '/login', //子路由路径前边必须写父路由路径
        name: 'login',
        component: Login
      }
    ]
  },

];

const router = new VueRouter({
  routes,
});

export default router;
